package com.example.mapper;

import com.example.dto.BorrowRecordDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BorrowRecordMapper {
    @Select("SELECT b.id, b.user_id, u.username, b.book_id, bk.name AS bookName, b.borrow_date, b.return_date " +
            "FROM tbl_borrow b " +
            "JOIN tbl_user u ON b.user_id = u.id " +
            "JOIN tbl_book bk ON b.book_id = bk.id")
    List<BorrowRecordDTO> getAllBorrowRecords();
}
